using System;
using System.Linq.Expressions;

namespace Domain.Common
{
	public class Specification<T>
	{
		private readonly Expression<Func<T, bool>> _expression;

		public Specification(Expression<Func<T, bool>> expression)
		{
			this._expression = expression;
		}

		public bool IsSatisfiedBy(T obj)
		{
			return this._expression.Compile()(obj);
		}
	}
}